#include <iostream>
#include <fstream>
#include <stdio.h>
#include <string.h>
#include <sstream>

using std::cout;
using std::endl;
using std::string;
using std::istringstream;

void oj()
{
    char buf[4096];
    char *p = buf;
    while(1){
        FILE *fp = popen("./test", "r");    
        fread(buf, 4095, 1, fp);
        // printf("%s\n", buf);
        
        string ret(buf);
        istringstream iss(ret);
        string tmp;
        int i = 10;
        while(i > 0 && tmp != "50"){
            i--;
            iss >> tmp;
        }
        if(i > 0){
            printf("%s\n", buf);
            break;
        }
        memset(buf, 0, 4095);
        pclose(fp);
    }
}

int main(int args, char *argv[])
{
    oj();
    return 0;
}